package com.tg.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

@TableName("tb_user")
@Data
public class User {

    //标记接口
    public interface Login{}

    @TableId(type = IdType.AUTO)
    private Integer id;
    @NotBlank(message = "头像不能为空!")
    private String avatar;
    @NotBlank(message = "用户名不能为空!",groups = Login.class)
    @NotBlank(message = "用户名不能为空!")
    private String username;
    @Range(min = 1L,max = 100L,message = "年龄输入有误!")
    private Integer age;
    private char sex;
    @NotBlank(message = "密码不能为空!",groups = Login.class)
    @NotBlank(message = "密码不能为空!")
    private String password;
    @NotBlank(message = "邮箱不能为空!")
    @Email(message = "邮箱格式有误!")
    private String email;
    private String label;
    @TableField(exist = false)
    private Integer online;
    @TableField(exist = false)
    @NotBlank(message = "验证码不能为空!",groups = Login.class)
    @NotBlank(message = "验证码不能为空!")
    private String code;

}
